<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>过渡动画</title>
    <style>
        *{
          margin: 0;
          padding: 0;
        }
        #obox{
            width: 200px;
            height: 200px;
            background: pink;
            position: absolute;
        }
        #btn{
            top: 200px;
            position: absolute;
        }
        .my-enter-to,
        .my-leave{
            left: 0;
            opacity: 1;
        }

        .my-enter,
        .my-leave-to{
            left: 200px;
            opacity: 1;
        }

        .my-enter-active,
        .my-leave-active{
          transition: all 2s;
        }
    </style>
</head>
<body>
<div id="app">
    <transition name="my">
        <div id="obox" v-if="isShow"></div>
    </transition>
    <button id="btn" @click="changeStatus">点击</button>
</div>
<script src="../instances/vue.js"></script>
<script>
    let vm = new Vue({
        el: '#app',
        data: {
            isShow: true
        },
        methods: {
            changeStatus: function () {
              this.isShow = !this.isShow
            }
        }
    })
</script>
</body>
</html>